package cn.kgc.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wangyue
 * @version 1.0
 */
@Configuration
public class RedissonConfig {
    /**
     * 创建RedissonClient对象
     */
    @Bean(destroyMethod = "shutdown")
    RedissonClient redissonClient(){
        Config config=new Config();
        config.useSingleServer()
                //服务地址
                .setAddress("redis://localhost:6379")
                //密码
                .setPassword("123456");
        return Redisson.create(config);
    }
}